package com.cwl.pattern.状态模式;

/**
 * @program: pattern
 * @description: 环境类
 * @author: ChenWenLong
 * @create: 2019-07-08 10:17
 **/
public class Context {

    private State state;
    //定义环境类的初始状态
    public Context() {
        this.state=new ConcreteStateA();
    }

    //设置新状态
    public void setState(State state) {
        this.state=state;
    }

    //读取状态
    public State getState() {
        return(state);
    }

    //对请求做处理
    public void Handle() {
        state.Handle(this);
    }
}
